Table Of Contents

Previous topic

FastNeighborList class

Next topic

Pysic Utility modules

This Page

CoreMirror class

CoreMirror is a Python representation of the Fortran core. When running pysic, it is intended that a single instance of CoreMirror exists, created automatically when importing pysic as the core object in Pysic.

Whenever changes are made in the Fortran core, they should also be reflected in the CoreMirror. This way one has always easy access to the state of the Fortran core without having to directly access the core and parse the data.

Normally, the user should not touch the CoreMirror directly. It is automatically handled through Pysic.

List of Methods

Full documentation of the CoreMirror class

class pysic.core.CoreMirror[source]

A class representing the status of the core.

Whenever data is being passed over to the core for calculation, it should also be saved in the CoreMirror. This makes the CoreMirror reflect the current status of the core. Then, when something needs to be calculated, the Pysic calculator can simply check that it contains the same system as the CoreMirror to ensure that the core operates on the correct data.

All data given to CoreMirror is saved as deep copies, i.e., not as the objects themselves but objects with exactly the same contents. This way if the original objects are modified, the ones in CoreMirror are not. This is the proper way to work, since the Fortran core obviously does not change without pushing the changes in the Python side to the core first.

Since exactly one CoreMirror should exist during the simulation, deletion of the instance (which should happen at program termination automatically) will automatically trigger release of memory in the Fortran core as well as termination of the MPI framework.

atoms_ready(atoms)[source]

Checks if the positions and momenta of the given atoms match those in the core.

True is returned if the structures match, False otherwise.

Parameters:

atoms: ASE Atoms object
The atoms to be compared.
cell_ready(atoms)[source]

Checks if the given supercell matches that in the core.

True is returned if the structures match, False otherwise.

Parameters:

atoms: ASE Atoms object
The cell to be compared.
charges_ready(atoms)[source]

Checks if the charges of the given atoms match those in the core.

True is returned if the charges match, False otherwise.

Parameters:

atoms: ASE Atoms object
The atoms to be compared.
coulomb_summation_ready(coulomb)[source]

Checks if the given Coulomb summation matches that in the core.

True is returned if the summation algorithms match, False otherwise.

Parameters: CoulombSummation
the summation algorithm to be compared
get_atoms()[source]

Returns the ASE Atoms structure stored in the CoreMirror.

neighbor_lists_ready(lists)[source]

Checks if the given neighbor lists match those in the core.

True is returned if the structures match, False otherwise.

Parameters:

atoms: ASE NeighborList object
The neighbor lists to be compared.
potentials_ready(pots)[source]

Checks if the given potentials match those in the core.

True is returned if the potentials match, False otherwise.

Parameters:

atoms: list of Potential objects
The potentials to be compared.
set_atomic_momenta(atoms)[source]

Copies and stores the momenta of atoms in the ASE Atoms instance.

Parameters:

atoms: ASE Atoms object
atomic structure containing the momenta to be saved.
set_atomic_positions(atoms)[source]

Copies and stores the positions of atoms in the ASE Atoms instance.

Parameters:

atoms: ASE Atoms object
atomic structure containing the positions to be saved.
set_atoms(atoms)[source]

Copies and stores the entire ASE Atoms instance.

Parameters:

atoms: ASE Atoms object
atomic structure to be saved
set_cell(atoms)[source]

Copies and stores the supercell in the ASE Atoms instance.

Parameters:

atoms: ASE Atoms object
atomic structure containing the supercell to be saved.
set_charges(charges)[source]

Copies and stores the charges of atoms in the ASE Atoms instance.

Parameters:

atoms: ASE Atoms object
atomic structure containing the positions to be saved.
set_coulomb(coulomb)[source]

Copies and stores the Coulomb summation algorithm.

Parameters:

coulomb: CoulombSummation
Coulomb summation algorithm to be saved
set_neighbor_lists(lists)[source]

Copies and stores the neighbor lists.

Parameters:

atoms: ASE NeighborList object
Neighbor lists to be saved.
set_potentials(potentials)[source]

Copies and stores Potential potentials.

The Potential instances are copied as a whole, so any possible Coordinator and BondOrderParameters objects are also stored.

Parameters:

atoms: list of Potential objects
Potentials to be saved.
view_fortran()[source]

Print some information on the data allocated in the Fortran core.

This is mainly a debugging utility for directly seeing the status of the core. It can be accessed through:

>>> pysic.Pysic.core.view_fortran()

The result is a bunch of data dumped to stdout. The function does not return anything.